# OVERRIDE of four vanilla scripted_triggers from common/scripted_triggers/00_scripted_triggers.txt.
# Each is copied VERBATIM from vanilla, with a single added line:
#     has_valid_civic = civic_xenomorph_brood_extermination_mandate
# placed alongside civic_hive_devouring_swarm in every relevant OR/NOR list. This grants the
# Brood Extermination Mandate civic genuine Total-War / homicidal behaviour (total-war CB, no
# normal diplomacy, purge) exactly the way Devouring Swarm gets it. Empires WITHOUT the civic
# are unaffected. NOTE: because these are full overrides of core vanilla triggers, they must be
# re-synced if a Stellaris patch changes the vanilla definitions, and they will conflict with any
# other mod that also overrides these four triggers.

has_total_war_cb = {
	OR = {
		#attacker checks
		AND = {
			OR = {
				is_country_type = default
				is_country_type = awakened_fallen_empire
				is_country_type = fallen_empire
			}
			OR = {
				is_country_type = awakened_fallen_empire
				has_valid_civic = civic_hive_devouring_swarm
				has_valid_civic = civic_xenomorph_brood_extermination_mandate
				has_menace_perk = menp_behemoth_ever_hungry
				has_valid_civic = civic_machine_assimilator
				has_valid_civic = civic_scorched_earth
				has_valid_civic = civic_hive_scorched_earth
				AND = {
					has_valid_civic = civic_machine_terminator
					from = {
						NOR = {
							has_country_flag = synthetic_empire
							is_machine_empire = yes
							is_individual_machine = yes
						}
					}
				}
				AND = {
					has_valid_civic = civic_fanatic_purifiers
					NOT = { is_same_species = from }
				}
			}
		}
		#end threat checks
		AND = {
			is_country_type = default
			NOR = {
				is_country_type = awakened_fallen_empire
				has_valid_civic = civic_fanatic_purifiers
				has_valid_civic = civic_hive_devouring_swarm
				has_valid_civic = civic_xenomorph_brood_extermination_mandate
				has_valid_civic = civic_machine_assimilator
				has_valid_civic = civic_machine_terminator
				has_valid_civic = civic_scorched_earth
				has_valid_civic = civic_hive_scorched_earth
			}
			from = {
				is_valid_end_threat_target = yes
			}
		}
		# EotC Total War
		has_country_flag = reached_eotc_situation_stage2
		# Total War against EotC
		AND = {
			has_country_flag = can_declare_total_war_to_eotc
			from = { has_covenant_with_end_of_the_cycle = yes }
		}
	}
}

is_valid_end_threat_target = {
	OR = {
		is_country_type = awakened_fallen_empire
		is_country_type = synth_queen
		has_valid_civic = civic_fanatic_purifiers
		has_valid_civic = civic_hive_devouring_swarm
		has_valid_civic = civic_xenomorph_brood_extermination_mandate
		has_valid_civic = civic_machine_assimilator
		has_valid_civic = civic_machine_terminator
		has_valid_civic = civic_scorched_earth
		has_valid_civic = civic_hive_scorched_earth
		has_menace_perk = menp_behemoth_ever_hungry
		has_country_flag = heir_of_the_khan_khan
		AND = {
			root = { has_country_flag = heir_of_the_khan_khan }
			OR = {
				is_galactic_emperor = yes
				is_galactic_custodian = yes
				has_been_declared_crisis = yes
			}
		}
	}
}

is_homicidal = {
	OR = {
		has_valid_civic = civic_fanatic_purifiers
		has_valid_civic = civic_machine_terminator
		has_valid_civic = civic_hive_devouring_swarm
		has_valid_civic = civic_xenomorph_brood_extermination_mandate
		has_valid_civic = civic_scorched_earth
		has_valid_civic = civic_hive_scorched_earth
		has_menace_perk = menp_behemoth_ever_hungry
	}
}

is_unfriendly = {
	OR = {
		has_valid_civic = civic_fanatic_purifiers
		has_valid_civic = civic_machine_terminator
		has_valid_civic = civic_hive_devouring_swarm
		has_valid_civic = civic_xenomorph_brood_extermination_mandate
		has_valid_civic = civic_barbaric_despoilers
		has_valid_civic = civic_scorched_earth
		has_valid_civic = civic_hive_scorched_earth
	}
}
